<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  I'm the outer html
  <iframe src="./index2.html" frameborder="0"></iframe>
  <script>
    //otherWindow.postMessage(message, targetOrigin, [transfer]);
    let iframe = document.querySelector("iframe")
    iframe.onload = function () {
      let obj = {
        from : 'index2',
        name: '测试',
        value: ['a', 'b', 'c']
      }
      iframe.contentWindow.postMessage(JSON.stringify(obj), 'http://localhost:8082')
    }
  </script>
</body>
</html>